home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / benchmarks / itc / gcc / tm-encore.h < prev    next >
Encoding:
C/C++ Source or Header  |  1989-08-30  |  5.5 KB  |  181 lines

  1. /* Definitions of target machine for GNU compiler.  ENCORE NS32000 version.
  2.    Copyright (C) 1988 Free Software Foundation, Inc.
  3.    Adapted by Robert Brown (brown@harvard.harvard.edu) from the Sequent
  4.      version by Michael Tiemann (tiemann@mcc.com).
  5.  
  6. This file is part of GNU CC.
  7.  
  8. GNU CC is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY.  No author or distributor
  10. accepts responsibility to anyone for the consequences of using it
  11. or for whether it serves any particular purpose or works at all,
  12. unless he says so in writing.  Refer to the GNU CC General Public
  13. License for full details.
  14.  
  15. Everyone is granted permission to copy, modify and redistribute
  16. GNU CC, but only under the conditions described in the
  17. GNU CC General Public License.   A copy of this license is
  18. supposed to have been given to you along with GNU CC so you
  19. can know your rights and responsibilities.  It should be in a
  20. file named COPYING.  Among other things, the copyright notice
  21. and this notice must be preserved on all copies.  */
  22.  
  23.  
  24. /*
  25.  *  Looks like all multiprocessors have this bug!
  26.  */
  27.  
  28. #define SEQUENT_ADDRESS_BUG 1
  29.  
  30. #include "tm-ns32k.h"
  31.  
  32.  
  33. #undef ASM_GENERATE_INTERNAL_LABEL
  34. #undef ASM_OUTPUT_ADDR_DIFF_ELT
  35. #undef ASM_OUTPUT_ALIGN
  36. #undef ASM_OUTPUT_ASCII
  37. #undef ASM_OUTPUT_DOUBLE
  38. #undef ASM_OUTPUT_INT
  39. #undef ASM_OUTPUT_INTERNAL_LABEL
  40. #undef ASM_OUTPUT_LOCAL
  41. #undef CPP_PREDEFINES
  42. #undef FUNCTION_BOUNDARY
  43. #undef PRINT_OPERAND
  44. #undef PRINT_OPERAND_ADDRESS
  45. #undef TARGET_VERSION
  46.  
  47.  
  48. #define TARGET_DEFAULT 1
  49. #define TARGET_VERSION printf (" (32000, Encore syntax)");
  50. #define CPP_PREDEFINES "-Dns32000 -Dencore -Dunix"
  51.  
  52. #define FUNCTION_BOUNDARY 128        /* speed optimization */
  53.  
  54. /*
  55.  *  The Encore assembler uses ".align 2" to align on 2-byte boundaries.
  56.  */
  57.  
  58. #define ASM_OUTPUT_ALIGN(FILE,LOG)                    \
  59.     fprintf (FILE, "\t.align %d\n", 1 << (LOG))
  60.  
  61. /*
  62.  *  Internal labels are prefixed with a period.
  63.  */
  64.  
  65. #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM)            \
  66.     sprintf (LABEL, "*.%s%d", PREFIX, NUM)
  67. #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM)            \
  68.     fprintf (FILE, ".%s%d:\n", PREFIX, NUM)
  69. #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL)            \
  70.     fprintf (FILE, "\t.word .L%d-.LI%d\n", VALUE, REL)
  71.  
  72. /*
  73.  *  Different syntax for integer constants, double constants, and
  74.  *  uninitialized locals.
  75.  */
  76.  
  77. #define ASM_OUTPUT_INT(FILE,VALUE)                \
  78. ( fprintf (FILE, "\t.double "),                    \
  79.   output_addr_const (FILE, (VALUE)),                \
  80.   fprintf (FILE, "\n"))
  81.  
  82. #define ASM_OUTPUT_DOUBLE(FILE,VALUE)                \
  83.  fprintf (FILE, "\t.long 0d%.20e\n", (VALUE))
  84.  
  85. #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE)            \
  86. ( fputs ("\t.bss ", (FILE)),                    \
  87.   assemble_name ((FILE), (NAME)),                \
  88.   fprintf ((FILE), ",%d,4\n", (SIZE)))
  89.  
  90.  /*
  91.   *  Encore assembler can't handle huge string constants like the one in
  92.   *  gcc.c.  If the default routine in varasm.c were more conservative, this
  93.   *  code could be eliminated.  It starts a new .ascii directive every 40
  94.   *  characters.
  95.   */
  96.  
  97. #define ASM_OUTPUT_ASCII(file, p, size)            \
  98. {                            \
  99.   for (i = 0; i < size; i++)                \
  100.     {                            \
  101.       register int c = p[i];                \
  102.       if ((i / 40) * 40 == i)                \
  103.       if (i == 0)                    \
  104.         fprintf (file, "\t.ascii \"");            \
  105.       else                        \
  106.         fprintf (file, "\"\n\t.ascii \"");        \
  107.       if (c == '\"' || c == '\\')            \
  108.         putc ('\\', file);                \
  109.       if (c >= ' ' && c < 0177)                \
  110.         putc (c, file);                    \
  111.       else                        \
  112.         {                        \
  113.           fprintf (file, "\\%o", c);            \
  114.           if (i < size - 1                 \
  115.               && p[i + 1] >= '0' && p[i + 1] <= '9')    \
  116.           fprintf (file, "\"\n\t.ascii \"");        \
  117.         }                        \
  118.     }                            \
  119.   fprintf (file, "\"\n");                \
  120. }
  121.  
  122.  /*
  123.   *  Dollar signs are required before immediate operands, double
  124.   *  floating point constants use $0l syntax, and external addresses
  125.   *  should be prefixed with a question mark to avoid assembler warnings
  126.   *  about undefined symbols.
  127.   */
  128.  
  129. #define PRINT_OPERAND(FILE, X, CODE)                    \
  130. { if (CODE == '$') putc ('$', FILE);                    \
  131.   else if (CODE == '?') fputc ('?', FILE);                \
  132.   else if (GET_CODE (X) == REG)                        \
  133.     fprintf (FILE, "%s", reg_name [REGNO (X)]);                \
  134.   else if (GET_CODE (X) == MEM)                        \
  135.     {                                    \
  136.       rtx xfoo;                                \
  137.       xfoo = XEXP (X, 0);                        \
  138.       switch (GET_CODE (xfoo))                        \
  139.     {                                \
  140.     case MEM:                            \
  141.       if (GET_CODE (XEXP (xfoo, 0)) == REG)                \
  142.         if (REGNO (XEXP (xfoo, 0)) == STACK_POINTER_REGNUM)        \
  143.           fprintf (FILE, "0(0(sp))");                \
  144.         else fprintf (FILE, "0(0(%s))",                \
  145.               reg_name [REGNO (XEXP (xfoo, 0))]);        \
  146.       else                                \
  147.         {                                \
  148.           fprintf (FILE, "0(");                    \
  149.           output_address (xfoo);                    \
  150.           putc (')', FILE);                        \
  151.         }                                \
  152.       break;                            \
  153.     case REG:                            \
  154.       fprintf (FILE, "0(%s)", reg_name [REGNO (xfoo)]);        \
  155.       break;                            \
  156.     case PRE_DEC:                            \
  157.     case POST_INC:                            \
  158.       fprintf (FILE, "tos");                    \
  159.       break;                            \
  160.     case CONST_INT:                            \
  161.       fprintf (FILE, "@%d", INTVAL (xfoo));                \
  162.       break;                            \
  163.     default:                            \
  164.       output_address (xfoo);                    \
  165.       break;                            \
  166.     }                                \
  167.     }                                    \
  168.   else if (GET_CODE (X) == CONST_DOUBLE)                \
  169.     if (GET_MODE (X) == DFmode)                        \
  170.       { union { double d; int i[2]; } u;                \
  171.     u.i[0] = XINT (X, 0); u.i[1] = XINT (X, 1);            \
  172.     fprintf (FILE, "$0l%.20e", u.d); }                \
  173.     else { union { float f; int i; } u;                    \
  174.        u.i = XINT (X, 0);                        \
  175.        fprintf (FILE, "$0f%.20e", u.f); }                \
  176.   else if (GET_CODE (X) == CONST)                    \
  177.     output_addr_const (FILE, X);                    \
  178.   else { putc ('$', FILE); output_addr_const (FILE, X); }}
  179.  
  180. #define PRINT_OPERAND_ADDRESS(FILE, ADDR)  print_operand_address(FILE, ADDR)
  181.